package com.firstwave.sfspringboot.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.firstwave.sfspringboot.dao.SysUserMapper;
import com.firstwave.sfspringboot.entity.SysUserVO;
import com.firstwave.sfspringboot.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: shafei
 * @Date: 2020-05-20 10:05
 * @Version: V1.0
 * @Description:
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserVO> implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    @Transactional
    public void updateAge() throws RuntimeException{
        //id为1的年龄设置为20，id为2的年龄设置为30
        SysUserVO sysUserVO=new SysUserVO();
        sysUserVO.setId("1");
        sysUserVO.setAge(30);
        sysUserMapper.updateById(sysUserVO);
        int i=1/0;
        SysUserVO sysUserVO2=new SysUserVO();
        sysUserVO2.setId("2");
        sysUserVO2.setAge(40);
        sysUserMapper.updateById(sysUserVO2);
    }
}
